//
//  TYZNetworkingTool.h
//  kanhujia
//
//  Created by lxl on 2018/5/14.
//  Copyright © 2018年 lxl. All rights reserved.
//

#import <Foundation/Foundation.h>
@class AFHTTPSessionManager;

/**
 *  网络连接类型
 */
typedef NS_ENUM(NSInteger, NetworkType) {
    NetworkType_None = 0,
    NetworkType_Wifi = 1,
    NetworkType_2G   = 2,
    NetworkType_3G   = 3,
    NetworkType_4G   = 4,
    NetworkType_5G   = 5
};
/**
 *  信号强度类型
 */
typedef NS_ENUM(NSInteger, NetworkIntensity) {
    NetworkIntensity_Default = 0, // 没有信号
    NetworkIntensity_Low     = 1, // <-80
    NetworkIntensity_Mid     = 2, // -80~-70
    NetworkIntensity_High    = 3, // >-70
};

#define NetTool [TYZNetworkingTool initial]
@interface TYZNetworkingTool : NSObject
/**
 *  请求管理者
 */
@property(nonatomic, strong) AFHTTPSessionManager *manager;
/**
 *  网络连接类型
 */
@property(nonatomic, assign) NetworkType networkType;
/**
 *  信号强度类型
 */
@property(nonatomic, assign) NetworkIntensity networkIntensity;
/**
 *  初始化
 */
+ (instancetype)initial;
- (void)setupCookie;
/**
 *  POST
 *
 *  @pram  port    具体接口
 *  @pram  params  参数
 *  @pram  success 成功回调
 *  @pram  failure 失败回调
 */
+ (void)post:(NSString *)port params:(NSDictionary *)params success:(void (^)(NSString *string, id data))success failure:(void (^)(NSString *error))failure;
@end
